import {
  configureStore,
} from '../@reduxjs/toolkit'

import todosApi from '../todosApi'

// 创建一个仓库
const store = configureStore({
  reducer: {
    [todosApi.reducerPath]: todosApi.reducer,
  },
  // 使用默认的中间件 + todosApi.middleware 中间件
  middleware: getDefaultMiddleware => getDefaultMiddleware().concat(todosApi.middleware),

})
window.store = store
export default store
